package org.jzr.dao;

import org.junit.Test;

public class UserDaoTest {
    //
    UserDao userDao = new UserDao();

    @Test
    public void insertUser() {
        int flag = userDao.insertUser("WangHaitao","123456");
        if (flag == 1){
            System.out.println("注册成功！");
        }else{
            System.out.println("注册失败！");
        }
    }

    @Test
    public void login() {
/*        //Java语言接收键盘数入的数据用Scanner类
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名:");
        String uname = scanner.next(); //接收键盘上输入的用户名
        System.out.println("请输入密码:");
        String upsw = scanner.next(); //接收键盘上输入的密码*/

        boolean flag = userDao.login("WangHaitao","12345");
        if (flag == true){
            System.out.println("登录成功！");
        } else {
            System.out.println("用户名或密码错误！");
        }
    }

    @Test
    public void deleteUser() {
        int flag = userDao.deleteUser(1);
        System.out.println(flag);
    }

    @Test
    public void updateUser() {
        int flag = userDao.updateUser(2,"yanglan","12346");
        System.out.println(flag);
    }

    @Test
    public void selectAllUser() {
        System.out.println(userDao.selectAllUser());
    }
}